package org.net5ijy.commons.http.test;

import static org.net5ijy.commons.http.constants.HttpHeaderNames.*;
import static org.net5ijy.commons.http.constants.Medias.APPLICATION_JSON_UTF8;

import java.io.IOException;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import org.net5ijy.commons.http.HttpClientHttp;

/**
 * org.net5ijy.commons.http.test.OtaPortalTaskList类
 *
 * @author xuguofeng
 * @date 2020/7/22 12:57
 */
@Slf4j
public class OtaPortalTaskList {

  public static void main(String[] args) throws IOException {

    HttpClientHttp clientHttp = new HttpClientHttp(
        "proxy.******.com",
        8080,
        "******",
        "******");

    String response = clientHttp.doPostForm(
        "https://******/******/******/******/tasks",
        new HashMap<String, String>(8) {
          {
            put("pageNo", "1");
            put("pageSize", "20");
          }
        },
        new HashMap<String, String>(2) {
          {
            put(HEADER_NAME_CONTENT_TYPE, APPLICATION_JSON_UTF8);
            put(HEADER_NAME_AUTHORIZATION, "******");
          }
        });

    System.out.println(response);

    // 关闭client
    clientHttp.close();
  }
}
